<%@include file="/header/head.jsp" %>
<jsp:include page="/header/header.jsp">
	<jsp:param value="Lsit of Posts" name="title"/>
</jsp:include>

<!-- end of menu_wrapper -->
<div id="content">

<a href="<spring:url value='/' />"> Home </a>
<a href="<c:url value="/j_spring_security_logout" />">Logout</a>

    <table width="80%" border="1" cellspacing="0" cellpadding="5">
        <tr>
            <th width="4%">No</th>
            <th width="30%">Filename</th>
            <th width="30%">Notes</th>
            <th width="16%">Type</th>
            <th width="20%">&nbsp;</th>
        </tr>
        <c:choose>
            <c:when test="${entities != null}">
                <c:forEach var="file" items="${entities}" varStatus="counter">
                    <tr>
                        <td>${counter.index + 1}</td>
                        <td>${file.filename}</td>
                        <td>${file.notes}</td>
                        <td>${file.type}</td>
                        <td><div align="center"><a href="download?id=${file.id}">Download</a> /
                            <a href="delete?id=${file.id}">Delete</a></div>
                        </td>
                    </tr>
                </c:forEach>
            </c:when>
        </c:choose>
    </table>

    <h2>Add New File</h2>
    <form:form commandName="entity" action="/spring-security/files/save" method="post" enctype="multipart/form-data">
		<table width="60%" border="1" cellspacing="0">
            <tr>
                <td width="35%"><strong>File to upload</strong></td>
                <td width="65%">
                	<input type="file" name="filePath" />
                </td>
            </tr>
            <tr>
                <td><strong>Notes</strong></td>
                <td>
                <form:input path="notes" />
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td><input type="submit" name="submit" value="Add"/></td>
            </tr>
        </table>
    </form:form>
 </div>
 
 <%@include file="/footer/footer.jsp" %>
